﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace QMERP.Infrastructure.EFCore.Migrations
{
    /// <inheritdoc />
    public partial class init31 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Attachment",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    OwnerId = table.Column<long>(type: "bigint", nullable: true),
                    OwnerType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    FileSize = table.Column<long>(type: "bigint", nullable: false),
                    FileExtend = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
                    BasePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    SavePath = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    CreatedBy = table.Column<long>(type: "bigint", nullable: false),
                    CreatedByName = table.Column<string>(type: "nvarchar(50)", nullable: false),
                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Attachment", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Attachment_Id",
                table: "Attachment",
                column: "Id");

            migrationBuilder.CreateIndex(
                name: "IX_Attachment_OwnerId",
                table: "Attachment",
                column: "OwnerId");

            migrationBuilder.CreateIndex(
                name: "IX_Attachment_OwnerType",
                table: "Attachment",
                column: "OwnerType");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Attachment");
        }
    }
}
